<% layout('/layouts/default.html', {title: '资方金融费率维护查询', libs: ['validate','fileupload','dataGrid']}){ %>
<div class="main-content">
	<div class="box box-main">
		<div class="box-header with-border">
			<div class="box-title">
				<i class="fa icon-note"></i> ${text('资方金融费率维护详情')}
                <% if (hasPermi('base:investorfinancialinfo:investorFinancialInfo:edit')){ %>
                    <button type="button" class="btn btn-primary" id="editView">${text('编辑单据')}</button>
                <% } %>
			</div>
			<div class="box-tools pull-right">
				<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
			</div>
		</div>
		<#form:form id="inputForm" model="${investorFinancialInfo}" action="${ctx}/base/investorfinancialinfo/investorFinancialInfo/saveTTLC" method="post" class="form-horizontal">
			<div class="box-body">
				<div class="form-unit">${text('基本信息')}</div>
				<#form:hidden path="investorFinancialInfoId" id="investorFinancialInfoId"/>
				<div class="row">
                    <div class="col-xs-6">
                        <div class="form-group">
                            <label class="control-label col-sm-4" title="">
                                <span class="required hide">*</span> ${text('编号')}：<i class="fa icon-question hide"></i></label>
                            <div class="col-sm-8">
                                <#form:hidden path="isNewRecord"/>
                                <#form:input path="investorFinancialInfoId" id="investorFinancialInfoId" maxlength="64" readonly="true" placeholder="自动生成" class="form-control"/>
                            </div>
                        </div>
                    </div>
                </div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required ">*</span> ${text('资方名称')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
                                <#form:select path="investorName" items="${listSupplier}"
                                itemLabel="supplierName" itemValue="supplierId" class="form-control required"  disabled="true"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required ">*</span> ${text('资方年天数')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="days" class="form-control required digits" disabled="true"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-2" title="">
								<span class="required hide">*</span> ${text('备注信息')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-10">
								<#form:textarea path="remarks" rows="4" maxlength="500" class="form-control" disabled="true"/>
							</div>
						</div>
					</div>
				</div>
                <div class="form-unit">${text('金融信息-LC金融比例维护')}</div>
                <div class="ml10 mr10">
                    <table id="lcFinancialRatioDataGrid"></table>
                </div>
                <div class="form-unit">${text('金融信息-TT金融比例维护')}</div>
                <div class="ml10 mr10">
                    <table id="ttFinancialRatioDataGrid"></table>
                </div>
                <div class="form-unit">${text('附件信息')}</div>
                <div class="row">
                    <div class="col-xs-12">
                        <div class="form-group">
                            <label class="control-label col-sm-2">
                                <span class="required hide">*</span> ${text('附件上传')}：</label>
                            <div class="col-sm-10">
                                <#form:fileupload id="uploadFile" bizKey="${investorFinancialInfo.id}" bizType="investorFinancialInfo_file"
                                uploadType="all" class="" readonly="true" preview="true"/>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="form-unit">${text('系统信息')}</div>
                <div class="row">
                    <div class="col-xs-6">
                        <div class="form-group">
                            <label class="control-label col-sm-4" title="">
                                <span class="required hide">*</span> ${text('创建日期')}：<i class="fa icon-question hide"></i></label>
                            <div class="col-sm-8">
                                <#form:input path="createDate" class="form-control" disabled="true"
                                dataFormat="datetime2" data-type="datetime" data-format="yyyy-MM-dd HH:mm:ss"/>
                            </div>
                        </div>
                    </div>
                    <div class="col-xs-6">
                        <div class="form-group">
                            <label class="control-label col-sm-4" title="">
                                <span class="required hide">*</span> ${text('创建人')}：<i class="fa icon-question hide"></i></label>
                            <div class="col-sm-8">
                                <!--<#form:input path="createBy" class="form-control" disabled="true"/>-->
                                <#form:select path="createBy" items="${listUser}" disabled="true"
                                itemLabel="userName" itemValue="userCode"  blankOption="true" class="form-control"/>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-xs-6">
                        <div class="form-group">
                            <label class="control-label col-sm-4" title="">
                                <span class="required hide">*</span> ${text('最后修改日期')}：<i class="fa icon-question hide"></i></label>
                            <div class="col-sm-8">
                                <#form:input path="updateDate" readonly="true" maxlength="20" class="form-control"
                                dataFormat="datetime2" data-type="datetime" data-format="yyyy-MM-dd HH:mm:ss"/>
                            </div>
                        </div>
                    </div>
                    <div class="col-xs-6">
                        <div class="form-group">
                            <label class="control-label col-sm-4" title="">
                                <span class="required hide">*</span> ${text('最后修改人')}：<i class="fa icon-question hide"></i></label>
                            <div class="col-sm-8">
                                <!--<#form:input path="updateBy" readonly="true" maxlength="20" class="form-control"/>-->
                                <#form:select path="updateBy" items="${listUser}" disabled="true"
                                itemLabel="userName" itemValue="userCode"  blankOption="true" class="form-control"/>
                            </div>
                        </div>
                    </div>
                </div>
			</div>
			<div class="box-footer">
				<div class="row">
					<div class="col-sm-offset-2 col-sm-10">
						<button type="button" class="btn btn-sm btn-default" id="btnCancel" onclick="js.closeCurrentTabPage()"><i class="fa fa-reply-all"></i> ${text('关 闭')}</button>
					</div>
				</div>
			</div>
		</#form:form>
	</div>
</div>
<% } %>
<script>
    //初始化LC金融比例维护DataGrid对象
    $("#lcFinancialRatioDataGrid").dataGrid({
        data: ${toJson(investorFinancialInfo.lcFinancialRatioList)},
        datatype: "local", // 设置本地数据
        autoGridHeight: function(){return 'auto'}, // 设置自动高度

        // 设置数据表格列
        columnModel: [
            {header:'状态', name:'status', editable:true, hidden:true},
            {header:'主键', name:'lcFinancialRatioId', editable:true, hidden:true},
            {header:'${text("选项名称")}', name:'optionsName', width:150, editable:false, edittype:'text', editoptions:{'maxlength':'100', 'class':'form-control'}},
            {header:'${text("保证金比例(%)")}', name:'marginRatio', width:150, editable:true, edittype:'text', editoptions:{'maxlength':'10', 'class':'form-control required'}},
            {header:'${text("预付费用比例(%)")}', name:'prepaidExpenseRatio', width:150, editable:true, edittype:'text', editoptions:{'maxlength':'10', 'class':'form-control required'}},
            {header:'${text("押汇比例(%)")}', name:'negotiatedRatio', width:150, editable:true, edittype:'text', editoptions:{'maxlength':'10', 'class':'form-control required'}},
            {header:'${text("资方金融信息ID")}', name:'investorFinancialInfoId.investorFinancialInfoId', editable:true, hidden:true}
        ],

        // 编辑表格参数
        editGrid: false,				// 是否是编辑表格
        editGridInitRowNum: 0,		// 编辑表格的初始化新增行数
        editGridAddRowBtn: $('#lcFinancialRatioDataGridAddRowBtn'),	// 子表增行按钮
        editGridAddRowInitData: {lcFinancialRatioId: '', status: Global.STATUS_NORMAL},	// 新增行的时候初始化的数据

        // 编辑表格的提交数据参数
        editGridInputFormListName: 'lcFinancialRatioList', // 提交的数据列表名
        editGridInputFormListAttrs: 'status,lcFinancialRatioId,optionsName,marginRatio,prepaidExpenseRatio,negotiatedRatio,investorFinancialInfoId.investorFinancialInfoId,', // 提交数据列表的属性字段

        // 加载成功后执行事件
        ajaxSuccess: function(data){

        }
    });

    //初始化TT金融比例维护DataGrid对象
    $("#ttFinancialRatioDataGrid").dataGrid({
        data: ${toJson(investorFinancialInfo.ttFinancialRatioList)},
        datatype: "local", // 设置本地数据
        autoGridHeight: function(){return 'auto'}, // 设置自动高度

        // 设置数据表格列
        columnModel: [
            {header:'状态', name:'status', editable:true, hidden:true},
            {header:'主键', name:'ttFinancialRatioId', editable:true, hidden:true},
            {header:'${text("选项名称")}', name:'optionsName', width:150, editable:false, edittype:'text', editoptions:{'maxlength':'100', 'class':'form-control'}},
            {header:'${text("保证金比例(%)")}', name:'marginRatio', width:150, editable:true, edittype:'text', editoptions:{'maxlength':'10', 'class':'form-control required'}},
            {header:'${text("预付费用比例(%)")}', name:'prepaidExpenseRatio', width:150, editable:true, edittype:'text', editoptions:{'maxlength':'10', 'class':'form-control required'}},
            {header:'${text("资方金融信息ID")}', name:'investorFinancialInfoId.investorFinancialInfoId', editable:true, hidden:true}
        ],

        // 编辑表格参数
        editGrid: false,				// 是否是编辑表格
        editGridInitRowNum: 0,		// 编辑表格的初始化新增行数
        editGridAddRowBtn: $('#ttFinancialRatioDataGridAddRowBtn'),	// 子表增行按钮
        editGridAddRowInitData: {ttFinancialRatioId: '', status: Global.STATUS_NORMAL},	// 新增行的时候初始化的数据

        // 编辑表格的提交数据参数
        editGridInputFormListName: 'ttFinancialRatioList', // 提交的数据列表名
        editGridInputFormListAttrs: 'status,ttFinancialRatioId,optionsName,marginRatio,prepaidExpenseRatio,investorFinancialInfoId.investorFinancialInfoId,', // 提交数据列表的属性字段

        // 加载成功后执行事件
        ajaxSuccess: function(data){

        }
    });
</script>
<script>
$("#inputForm").validate({
	submitHandler: function(form){
		js.ajaxSubmitForm($(form), function(data){
			js.showMessage(data.message);
			if(data.result == Global.TRUE){
				js.closeCurrentTabPage(function(contentWindow){
					contentWindow.page();
				});
			}
		}, "json");
    }
});
</script>
<script>
    $("#editView").click(function () {
        var id = $("#investorFinancialInfoId").val();
        var URL = '${ctx}/base/investorfinancialinfo/investorFinancialInfo/formTTLC?investorFinancialInfoId=' + id;
        window.location.href =URL;
    });
</script>



